<template><div><h1 id="常用插件介绍" tabindex="-1"><a class="header-anchor" href="#常用插件介绍" aria-hidden="true">#</a> 常用插件介绍</h1>
<h3 id="_1、korofileheader-注释生成插件" tabindex="-1"><a class="header-anchor" href="#_1、korofileheader-注释生成插件" aria-hidden="true">#</a> 1、KoroFileHeader(注释生成插件)</h3>
<p><strong>使用插件</strong></p>
<table>
<thead>
<tr>
<th>作用</th>
<th>快捷键</th>
</tr>
</thead>
<tbody>
<tr>
<td>头部注释</td>
<td>ctrl+win+i</td>
</tr>
<tr>
<td>函数注释</td>
<td>ctrl+win+t</td>
</tr>
</tbody>
</table>
<p><strong>KoroFileHeader 所有默认参数如下：</strong></p>
<div class="language-javascript ext-js line-numbers-mode"><pre v-pre class="language-javascript"><code><span class="token comment">// 头部注释</span>
<span class="token string-property property">"fileheader.customMade"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token comment">// Author字段是文件的创建者 可以在specialOptions中更改特殊属性</span>
    <span class="token comment">// 公司项目和个人项目可以配置不同的用户名与邮箱 搜索: gitconfig includeIf  比如: https://ayase.moe/2021/03/09/customized-git-config/</span>
    <span class="token comment">// 自动提取当前git config中的: 用户名、邮箱</span>
    <span class="token string-property property">"Author"</span><span class="token operator">:</span> <span class="token string">"git config user.name &amp;&amp; git config user.email"</span><span class="token punctuation">,</span> <span class="token comment">// 同时获取用户名与邮箱</span>
    <span class="token comment">// "Author": "git config user.name", // 仅获取用户名</span>
    <span class="token comment">// "Author": "git config user.email", // 仅获取邮箱</span>
    <span class="token comment">// "Author": "OBKoro1", // 写死的固定值 不从git config中获取</span>
    <span class="token string-property property">"Date"</span><span class="token operator">:</span> <span class="token string">"Do not edit"</span><span class="token punctuation">,</span> <span class="token comment">// 文件创建时间(不变)</span>
    <span class="token comment">// LastEditors、LastEditTime、FilePath将会自动更新 如果觉得时间更新的太频繁可以使用throttleTime(默认为1分钟)配置更改更新时间。</span>
    <span class="token string-property property">"LastEditors"</span><span class="token operator">:</span> <span class="token string">"git config user.name &amp;&amp; git config user.email"</span><span class="token punctuation">,</span> <span class="token comment">// 文件最后编辑者 与Author字段一致</span>
    <span class="token comment">// 由于编辑文件就会变更最后编辑时间，多人协作中合并的时候会导致merge</span>
    <span class="token comment">// 可以将时间颗粒度改为周、或者月，这样冲突就减少很多。搜索变更时间格式: dateFormat</span>
    <span class="token string-property property">"LastEditTime"</span><span class="token operator">:</span> <span class="token string">"Do not edit"</span><span class="token punctuation">,</span> <span class="token comment">// 文件最后编辑时间</span>
    <span class="token comment">// 输出相对路径，类似: /文件夹名称/src/index.js</span>
    <span class="token string-property property">"FilePath"</span><span class="token operator">:</span> <span class="token string">"Do not edit"</span><span class="token punctuation">,</span> <span class="token comment">// 文件在项目中的相对路径 自动更新</span>
    <span class="token comment">// 插件会自动将光标移动到Description选项中 方便输入 Description字段可以在specialOptions更改</span>
    <span class="token string-property property">"Description"</span><span class="token operator">:</span> <span class="token string">""</span><span class="token punctuation">,</span> <span class="token comment">// 介绍文件的作用、文件的入参、出参。</span>
    <span class="token comment">// custom_string_obkoro1~custom_string_obkoro100都可以输出自定义信息</span>
    <span class="token comment">// 可以设置多条自定义信息 设置个性签名、留下QQ、微信联系方式、输入空行等</span>
    <span class="token string-property property">"custom_string_obkoro1"</span><span class="token operator">:</span> <span class="token string">""</span><span class="token punctuation">,</span> 
    <span class="token comment">// 版权声明 保留文件所有权利 自动替换年份 获取git配置的用户名和邮箱</span>
    <span class="token comment">// 版权声明获取git配置, 与Author字段一致: ${git_name} ${git_email} ${git_name_email}</span>
    <span class="token string-property property">"custom_string_obkoro1_copyright"</span><span class="token operator">:</span> <span class="token string">"Copyright (c) ${now_year} by ${git_name_email}, All Rights Reserved. "</span>
    <span class="token comment">// "custom_string_obkoro1_copyright": "Copyright (c) ${now_year} by 写死的公司名/用户名, All Rights Reserved. "</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token comment">// 函数注释</span>
<span class="token string-property property">"fileheader.cursorMode"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token string-property property">"description"</span><span class="token operator">:</span> <span class="token string">""</span><span class="token punctuation">,</span> <span class="token comment">// 函数注释生成之后，光标移动到这里</span>
    <span class="token string-property property">"param"</span><span class="token operator">:</span> <span class="token string">""</span><span class="token punctuation">,</span> <span class="token comment">// param 开启函数参数自动提取 需要将光标放在函数行或者函数上方的空白行</span>
    <span class="token string-property property">"return"</span><span class="token operator">:</span> <span class="token string">""</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token comment">// 插件配置项</span>
<span class="token string-property property">"fileheader.configObj"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token string-property property">"autoAdd"</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span> <span class="token comment">// 检测文件没有头部注释，自动添加文件头部注释</span>
    <span class="token string-property property">"autoAddLine"</span><span class="token operator">:</span> <span class="token number">100</span><span class="token punctuation">,</span> <span class="token comment">// 文件超过多少行数 不再自动添加头部注释</span>
    <span class="token string-property property">"autoAlready"</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span> <span class="token comment">// 只添加插件支持的语言以及用户通过`language`选项自定义的注释</span>
    <span class="token string-property property">"supportAutoLanguage"</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token comment">// 设置之后，在数组内的文件才支持自动添加</span>
   <span class="token comment">// 自动添加头部注释黑名单</span>
   <span class="token string-property property">"prohibitAutoAdd"</span><span class="token operator">:</span> <span class="token punctuation">[</span>
      <span class="token string">"json"</span>
    <span class="token punctuation">]</span><span class="token punctuation">,</span>
   <span class="token string-property property">"prohibitItemAutoAdd"</span><span class="token operator">:</span> <span class="token punctuation">[</span> <span class="token string">"项目的全称禁止项目自动添加头部注释, 使用快捷键自行添加"</span> <span class="token punctuation">]</span><span class="token punctuation">,</span>
   <span class="token string-property property">"folderBlacklist"</span><span class="token operator">:</span> <span class="token punctuation">[</span> <span class="token string">"node_modules"</span> <span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token comment">// 文件夹或文件名禁止自动添加头部注释</span>
   <span class="token string-property property">"wideSame"</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token comment">// 头部注释等宽设置</span>
   <span class="token string-property property">"wideNum"</span><span class="token operator">:</span> <span class="token number">13</span><span class="token punctuation">,</span>  <span class="token comment">// 头部注释字段长度 默认为13</span>
    <span class="token string-property property">"functionWideNum"</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token comment">// 函数注释等宽设置 设为0 即为关闭</span>
   <span class="token comment">// 头部注释第几行插入</span>
    <span class="token string-property property">"headInsertLine"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
      <span class="token string-property property">"php"</span><span class="token operator">:</span> <span class="token number">2</span> <span class="token comment">// php文件 插入到第二行</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token string-property property">"beforeAnnotation"</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token comment">// 头部注释之前插入内容</span>
    <span class="token string-property property">"afterAnnotation"</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token comment">// 头部注释之后插入内容</span>
    <span class="token string-property property">"specialOptions"</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token comment">// 特殊字段自定义 比如: Author、LastEditTime、LastEditors、FilePath、Description、Date等</span>
    <span class="token string-property property">"switch"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
      <span class="token string-property property">"newlineAddAnnotation"</span><span class="token operator">:</span> <span class="token boolean">true</span> <span class="token comment">// 默认遇到换行符(\r\n \n \r)添加注释符号</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token string-property property">"moveCursor"</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span> <span class="token comment">// 自动移动光标到Description所在行</span>
    <span class="token string-property property">"dateFormat"</span><span class="token operator">:</span> <span class="token string">"YYYY-MM-DD HH:mm:ss"</span><span class="token punctuation">,</span>
    <span class="token string-property property">"atSymbol"</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">"@"</span><span class="token punctuation">,</span> <span class="token string">"@"</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token comment">// 更改所有文件的自定义注释中的@符号</span>
    <span class="token string-property property">"atSymbolObj"</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token comment">//  更改单独语言/文件的@</span>
    <span class="token string-property property">"colon"</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">": "</span><span class="token punctuation">,</span> <span class="token string">": "</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token comment">// 更改所有文件的注释冒号</span>
    <span class="token string-property property">"colonObj"</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token comment">//  更改单独语言/文件的冒号</span>
    <span class="token string-property property">"filePathColon"</span><span class="token operator">:</span> <span class="token string">"路径分隔符替换"</span><span class="token punctuation">,</span> <span class="token comment">// 默认值： mac: / window是: \</span>
    <span class="token string-property property">"showErrorMessage"</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token comment">// 是否显示插件错误通知 用于debugger</span>
    <span class="token string-property property">"writeLog"</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token comment">// 错误日志生成</span>
    <span class="token string-property property">"CheckFileChange"</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token comment">// 单个文件保存时进行diff检查</span>
    <span class="token string-property property">"createHeader"</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token comment">// 新建文件自动添加头部注释</span>
    <span class="token string-property property">"useWorker"</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token comment">// 是否使用工作区设置</span>
    <span class="token string-property property">"designAddHead"</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token comment">// 添加注释图案时添加头部注释</span>
    <span class="token string-property property">"headDesignName"</span><span class="token operator">:</span> <span class="token string">"random"</span><span class="token punctuation">,</span> <span class="token comment">// 图案注释使用哪个图案 </span>
    <span class="token string-property property">"headDesign"</span><span class="token operator">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span> <span class="token comment">// 是否使用图案注释替换头部注释</span>
    <span class="token comment">// 自定义配置是否在函数内生成注释 不同文件类型和语言类型</span>
    <span class="token string-property property">"cursorModeInternalAll"</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token comment">// 默认为false 在函数外生成函数注释</span>
    <span class="token string-property property">"openFunctionParamsCheck"</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span> <span class="token comment">// 开启关闭自动提取添加函数参数</span>
    <span class="token string-property property">"functionParamsShape"</span><span class="token operator">:</span> <span class="token punctuation">[</span><span class="token string">"{"</span><span class="token punctuation">,</span> <span class="token string">"}"</span><span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token comment">// 函数参数外形自定义 </span>
    <span class="token comment">// "functionParamsShape": "no type" 函数参数不需要类型</span>
    <span class="token string-property property">"functionBlankSpaceAll"</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token comment">// 函数注释空格缩进 默认为空对象 默认值为0 不缩进</span>
    <span class="token string-property property">"functionTypeSymbol"</span><span class="token operator">:</span> <span class="token string">"*"</span><span class="token punctuation">,</span> <span class="token comment">// 参数没有类型时的默认值</span>
    <span class="token string-property property">"typeParamOrder"</span><span class="token operator">:</span> <span class="token string">"type param"</span><span class="token punctuation">,</span> <span class="token comment">// 参数类型 和 参数的位置自定义</span>
    <span class="token string-property property">"NoMatchParams"</span><span class="token operator">:</span> <span class="token string">"no show param"</span><span class="token punctuation">,</span> <span class="token comment">// 没匹配到函数参数，是否显示@param与@return这两行 默认不显示param</span>
    <span class="token string-property property">"functionParamAddStr"</span><span class="token operator">:</span> <span class="token string">""</span><span class="token punctuation">,</span> <span class="token comment">// 在 type param 后面增加字符串 可能是冒号，方便输入参数描述</span>
    <span class="token comment">// 自定义语言注释，自定义取消 head、end 部分</span>
    <span class="token comment">// 不设置自定义配置language无效 默认都有head、end</span>
    <span class="token string-property property">"customHasHeadEnd"</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token comment">// "cancel head and function" | "cancel head" | "cancel function" </span>
    <span class="token string-property property">"throttleTime"</span><span class="token operator">:</span> <span class="token number">60000</span><span class="token punctuation">,</span> <span class="token comment">// 对同一个文件 需要过1分钟再次修改文件并保存才会更新注释</span>
     <span class="token comment">// 自定义语言注释符号，覆盖插件的注释格式</span>
    <span class="token string-property property">"language"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
        <span class="token comment">// js后缀文件</span>
        <span class="token string-property property">"js"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
            <span class="token string-property property">"head"</span><span class="token operator">:</span> <span class="token string">"/$$"</span><span class="token punctuation">,</span>
            <span class="token string-property property">"middle"</span><span class="token operator">:</span> <span class="token string">" $ @"</span><span class="token punctuation">,</span>
            <span class="token string-property property">"end"</span><span class="token operator">:</span> <span class="token string">" $/"</span><span class="token punctuation">,</span>
            <span class="token comment">// 函数自定义注释符号：如果有此配置 会默认使用</span>
            <span class="token string-property property">"functionSymbol"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
              <span class="token string-property property">"head"</span><span class="token operator">:</span> <span class="token string">"/******* "</span><span class="token punctuation">,</span> <span class="token comment">// 统一增加几个*号</span>
              <span class="token string-property property">"middle"</span><span class="token operator">:</span> <span class="token string">" * @"</span><span class="token punctuation">,</span>
              <span class="token string-property property">"end"</span><span class="token operator">:</span> <span class="token string">" */"</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token string-property property">"functionParams"</span><span class="token operator">:</span> <span class="token string">"typescript"</span> <span class="token comment">// 函数注释使用ts语言的解析逻辑</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
       <span class="token comment">// 一次匹配多种文件后缀文件 不用重复设置</span>
       <span class="token string-property property">"h/hpp/cpp"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
          <span class="token string-property property">"head"</span><span class="token operator">:</span> <span class="token string">"/*** "</span><span class="token punctuation">,</span> <span class="token comment">// 统一增加几个*号</span>
          <span class="token string-property property">"middle"</span><span class="token operator">:</span> <span class="token string">" * @"</span><span class="token punctuation">,</span>
          <span class="token string-property property">"end"</span><span class="token operator">:</span> <span class="token string">" */"</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token comment">// 针对有特殊要求的文件如：test.blade.php</span>
        <span class="token string-property property">"blade.php"</span><span class="token operator">:</span><span class="token punctuation">{</span>
          <span class="token string-property property">"head"</span><span class="token operator">:</span> <span class="token string">"&lt;!--"</span><span class="token punctuation">,</span>
          <span class="token string-property property">"middle"</span><span class="token operator">:</span> <span class="token string">" * @"</span><span class="token punctuation">,</span>
          <span class="token string-property property">"end"</span><span class="token operator">:</span> <span class="token string">"-->"</span><span class="token punctuation">,</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
 <span class="token comment">// 默认注释  没有匹配到注释符号的时候使用。</span>
 <span class="token string-property property">"annotationStr"</span><span class="token operator">:</span> <span class="token punctuation">{</span> 
      <span class="token string-property property">"head"</span><span class="token operator">:</span> <span class="token string">"/*"</span><span class="token punctuation">,</span>
      <span class="token string-property property">"middle"</span><span class="token operator">:</span> <span class="token string">" * @"</span><span class="token punctuation">,</span>
      <span class="token string-property property">"end"</span><span class="token operator">:</span> <span class="token string">" */"</span><span class="token punctuation">,</span>
      <span class="token string-property property">"use"</span><span class="token operator">:</span> <span class="token boolean">false</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></div></template>


